from sqlalchemy import Integer, Column, String, DateTime

from server.config.database import Base


class DataResource(Base):
    """
    数据资源表
    """

    __tablename__ = 't_scan_records_info'

    id = Column(Integer, primary_key=True, autoincrement=True, comment='主键ID')
    task_type = Column(Integer, comment='2人工上传的文件，5系统扫描的文件，6系统扫描的数据库表，7系统扫描的数据库字段')
    resource_id = Column(Integer, default=None, comment='资源id')
    resource_name = Column(String(128), default=None, comment='资源名称')
    database_schema = Column('database_name', String(128), default=None, comment='数据库schema')
    database_table = Column(String(255), comment='表名称')
    file_name = Column(String(255), comment='文件名称')
    field_name = Column(String(255), comment='字段名称')
    system_name = Column(String(128), default=None, comment='业务系统名称')
    data_owner = Column(String(128), default=None, comment='数据所有者')
    data_manager = Column(String(128), default=None, comment='数据管理者')
    create_time = Column(DateTime, default=None, comment='创建时间')
    update_time = Column(DateTime, default=None, comment='更新时间')